﻿@inherits AddProductDialogBase

@if (ShowDialog)
{
    <div class="modal fade show d-block" id="exampleModal" tabindex="-1" role="dialog">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="titleLabel">@Title</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close" @onclick="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">

                    <EditForm Model="@Product" OnValidSubmit="@HandleValidSubmit">

                        <DataAnnotationsValidator />
                        <ValidationSummary />

                        <div class="form-group">
                            <label for="lastName">Code: </label>
                            <InputText id="lastName" class="form-control" @bind-Value="@Product.Code" placeholder="Enter Product Code"></InputText>
                            <ValidationMessage For="@(() => Product.Code)" />
                        </div>

                        <div class="form-group">
                            <label for="firstName">Name: </label>
                            <InputText id="firstName" class="form-control" @bind-Value="@Product.Name" placeholder="Enter Product Name"></InputText>
                            <ValidationMessage For="@(() => Product.Name)" />
                        </div>

                        <div class="form-group">
                            <label for="email">Description: </label>
                            <InputText id="email" class="form-control" @bind-Value="@Product.Description" placeholder="Enter Product Description"></InputText>
                            <ValidationMessage For="@(() => Product.Description)" />
                        </div>
                        <button type="submit" class="btn btn-primary">Save Product</button>
                        <a class="btn btn-outline-primary" @onclick="@Close">Close</a>
                    </EditForm>

                </div>
            </div>
        </div>
    </div>
}